package com.oi.test01.hw.tiMu1;

import com.oi.test01.entity.Student;

import java.lang.reflect.Constructor;

/**
 * @author bin
 * @date 2025 - 03 -17
 * 练习分别使用四种方法获取类的 Class 对象，进行相关的操作
 **/
public class MainTest01 {
    public static void main(String[] args) throws Exception {
        Class<?> clazz = Class
                .forName("com.oi.test01.entity.Student");

        Constructor<?> constructor =
                clazz.getConstructor(String.class, int.class, float.class);

        Object obj = constructor.newInstance("张三", 18, 80.0F);

        Student stu = (Student)obj;

        System.out.println(stu);
    }
}
